package assist.datastore.dao;

import java.util.Collection;

/**
 * Provides the base methods for CRUD operations to the datastore.
 * Datastore must be injected into constructor.
 * 
 * Simply provides a convenience methods to access the datastore.
 */
public abstract class AbstractDAO<T>
{
    private Class<T> domainClass;
    protected AbstractDAO(final Class<T> domainClass)
    {
       
       this.domainClass = domainClass;
    }    
    
    /**
     * @return the Class type of the base Entity that the DAO acts on.
     */
    protected Class<T> getDomainClass()
    {
        return this.domainClass;
    }
    
    public abstract T save(T obj);   
    public abstract Collection<T> saveAll(final Collection<T> objects);    
    public abstract T getById(Object id);    
}
